<template>
  <div>
    <div class="login-box">
      <b-card style="width: 20%">
        <template #header>
          <span>海尔后台管理系统</span>
        </template>
        <div>
          <b-form>
            <b-form-group label="帐号">
              <b-input v-model="form.username"></b-input>
            </b-form-group>
            <b-form-group label="密码">
              <b-input type="password" v-model="form.password"></b-input>
            </b-form-group>
          </b-form>
          <b-button @click="login">登陆</b-button>
        </div>
      </b-card>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      form: {
        username: "",
        password: "",
      },
    };
  },
  methods: {
    login() {
        console.log("???")
      this.$haier.post("openapi/login", this.form).then(() => {
        localStorage.setItem("status", true);
        this.$router.push("/");
      }).catch(res=>{
          console.log(res)
      });
    }
  },
};
</script>

<style scoped>
.login-box > :first-child {
  margin: 0 auto;
  margin-top: 150px;
}
</style>